package com.example.tiku2;


import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;

public class VpFragment extends Fragment {
    private ImageView img_vp_fragment;
    private TextView tv;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_vp, container, false);
        initView(view);
        return view;
    }

    private void initView(View view) {
        img_vp_fragment = (ImageView) view.findViewById(R.id.img_vp_fragment);
        tv = (TextView) view.findViewById(R.id.tv);
        Bundle b = getArguments();
        String imgUrl = b.getString("imgUrl");
        int page = b.getInt("page");
        int allPage = b.getInt("allPage");
        Glide.with(getActivity()).load(imgUrl).into(img_vp_fragment);
        String str = "第" + (page + 1) + "张/总共" + allPage + "张";
        tv.setText(str);
    }
}
